package com.study.cloud.simpleconsumermovie.controller;

import com.study.cloud.simpleconsumermovie.feign.MovieFeign;
import com.study.cloud.simpleconsumermovie.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

@RestController
public class MovieController {

    /*@Autowired
    private RestTemplate restTemplate;*/

    @Autowired
    private MovieFeign movieFeign;

    @GetMapping("/simple/{id}")
    public User findById(@PathVariable Long id) {
        //return restTemplate.getForObject("http://simple-provider-user/simple/"+id ,User.class);
        return movieFeign.findById(id);
    }

    /*@GetMapping("/user")
    public User testPost(User user) {
        //return restTemplate.getForObject("http://simple-provider-user/simple/"+id ,User.class);
        return movieFeign.postUser(user);
    }*/
}
